<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>docker实践(附windows安装下载教程) | Jaho’s Blog</title>
    <meta name="generator" content="VuePress 1.8.0">
    <link rel="icon" href="/favicon.ico">
    <link rel="manifest" href="/manifest.json">
    <meta name="description" content="记录日常学习工作">
    
    <link rel="preload" href="/assets/css/0.styles.5b8fe0a4.css" as="style"><link rel="preload" href="/assets/js/app.6514719e.js" as="script"><link rel="preload" href="/assets/js/2.ea114ffb.js" as="script"><link rel="preload" href="/assets/js/43.de1cff16.js" as="script"><link rel="preload" href="/assets/js/4.e093c564.js" as="script"><link rel="prefetch" href="/assets/js/10.13203aa5.js"><link rel="prefetch" href="/assets/js/11.099868c4.js"><link rel="prefetch" href="/assets/js/12.c8365e17.js"><link rel="prefetch" href="/assets/js/13.89751e7c.js"><link rel="prefetch" href="/assets/js/14.31f563eb.js"><link rel="prefetch" href="/assets/js/15.08b381b6.js"><link rel="prefetch" href="/assets/js/16.1a3867de.js"><link rel="prefetch" href="/assets/js/17.7dd4e0c6.js"><link rel="prefetch" href="/assets/js/18.907c4597.js"><link rel="prefetch" href="/assets/js/19.fac8aa1a.js"><link rel="prefetch" href="/assets/js/20.73fe0e75.js"><link rel="prefetch" href="/assets/js/21.5c50aa1c.js"><link rel="prefetch" href="/assets/js/22.83d03663.js"><link rel="prefetch" href="/assets/js/23.061e7ac0.js"><link rel="prefetch" href="/assets/js/24.cc7e9011.js"><link rel="prefetch" href="/assets/js/25.fa6c7aef.js"><link rel="prefetch" href="/assets/js/26.39392f70.js"><link rel="prefetch" href="/assets/js/27.204436be.js"><link rel="prefetch" href="/assets/js/28.3f54c157.js"><link rel="prefetch" href="/assets/js/29.799d048c.js"><link rel="prefetch" href="/assets/js/3.6c5d6214.js"><link rel="prefetch" href="/assets/js/30.deed02f3.js"><link rel="prefetch" href="/assets/js/31.5916873b.js"><link rel="prefetch" href="/assets/js/32.b0634144.js"><link rel="prefetch" href="/assets/js/33.734675b8.js"><link rel="prefetch" href="/assets/js/34.20404dc4.js"><link rel="prefetch" href="/assets/js/35.d93b829f.js"><link rel="prefetch" href="/assets/js/36.b0692d8d.js"><link rel="prefetch" href="/assets/js/37.3dffa306.js"><link rel="prefetch" href="/assets/js/38.04649a97.js"><link rel="prefetch" href="/assets/js/39.7dfcdc32.js"><link rel="prefetch" href="/assets/js/40.04914511.js"><link rel="prefetch" href="/assets/js/41.ced85449.js"><link rel="prefetch" href="/assets/js/42.72739213.js"><link rel="prefetch" href="/assets/js/44.48e301ae.js"><link rel="prefetch" href="/assets/js/45.870a7650.js"><link rel="prefetch" href="/assets/js/46.657f15b8.js"><link rel="prefetch" href="/assets/js/47.3df1bfdb.js"><link rel="prefetch" href="/assets/js/48.f4e4e774.js"><link rel="prefetch" href="/assets/js/49.632bf611.js"><link rel="prefetch" href="/assets/js/5.6531e181.js"><link rel="prefetch" href="/assets/js/50.a8018493.js"><link rel="prefetch" href="/assets/js/51.cb424f59.js"><link rel="prefetch" href="/assets/js/52.a9f595dc.js"><link rel="prefetch" href="/assets/js/53.cf8a9ec0.js"><link rel="prefetch" href="/assets/js/54.46d774a3.js"><link rel="prefetch" href="/assets/js/55.3574f9b8.js"><link rel="prefetch" href="/assets/js/56.baf60ba5.js"><link rel="prefetch" href="/assets/js/57.af42b559.js"><link rel="prefetch" href="/assets/js/58.9300cb59.js"><link rel="prefetch" href="/assets/js/6.00f437ec.js"><link rel="prefetch" href="/assets/js/7.58ac7166.js"><link rel="prefetch" href="/assets/js/8.1b9c5002.js"><link rel="prefetch" href="/assets/js/9.5c076362.js">
    <link rel="stylesheet" href="/assets/css/0.styles.5b8fe0a4.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/logo.png" alt="Jaho’s Blog" class="logo"> <span class="site-name can-hide">Jaho’s Blog</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/posts/" class="nav-link router-link-active">
  技术博客
</a></div> <a href="https://juejin.cn/user/26836627369806" target="_blank" rel="noopener noreferrer" class="repo-link">
    个人主页
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/posts/" class="nav-link router-link-active">
  技术博客
</a></div> <a href="https://juejin.cn/user/26836627369806" target="_blank" rel="noopener noreferrer" class="repo-link">
    个人主页
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><a href="/posts/" aria-current="page" class="sidebar-link">写在前面</a></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>工作问题解决</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/posts/项目问题解决/vuevite.html" class="sidebar-link">vue3+vite用proxy解决跨域及proxy原理解析</a></li><li><a href="/posts/项目问题解决/大文件.html" class="sidebar-link">大文件切片上传和断点续传</a></li><li><a href="/posts/项目问题解决/代码优化.html" class="sidebar-link">实际工作中代码优化</a></li><li><a href="/posts/项目问题解决/组件问题.html" class="sidebar-link">解决组件传值问题</a></li><li><a href="/posts/项目问题解决/动态组件.html" class="sidebar-link">动态组件实践</a></li><li><a href="/posts/项目问题解决/大屏.html" class="sidebar-link">大屏九宫格视频</a></li><li><a href="/posts/项目问题解决/滚动.html" class="sidebar-link">Vue中Element表单定位滚动到校验错误位置</a></li><li><a href="/posts/项目问题解决/红绿灯.html" class="sidebar-link">Promise实现动态红绿灯切换</a></li><li><a href="/posts/项目问题解决/懒加载.html" class="sidebar-link">实现元素懒加载</a></li><li><a href="/posts/项目问题解决/小程序组件.html" class="sidebar-link">微信小程序封装组件</a></li><li><a href="/posts/项目问题解决/axios.html" class="sidebar-link">项目中对axios的整体封装</a></li><li><a href="/posts/项目问题解决/docker.html" class="active sidebar-link">docker实践(附windows安装下载教程)</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/posts/项目问题解决/eltable.html" class="sidebar-link">el-table自定义表头及无数据状态</a></li><li><a href="/posts/项目问题解决/gojs.html" class="sidebar-link">gojs入门学习</a></li><li><a href="/posts/项目问题解决/react踩坑.html" class="sidebar-link">React踩坑</a></li><li><a href="/posts/项目问题解决/小程序踩坑.html" class="sidebar-link">小程序踩坑</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>JavaScript</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Css</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Nodejs</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Vue</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Git</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="docker实践-附windows安装下载教程"><a href="#docker实践-附windows安装下载教程" class="header-anchor">#</a> docker实践(附windows安装下载教程)</h1> <h3 id="☀️前言"><a href="#☀️前言" class="header-anchor">#</a> ☀️前言</h3> <p>开发中经常会存在遇到一些很麻烦并且很神奇的问题，比如公司的一个前端项目写在了后端项目中，所以我需要让后端项目跑起来我才能访问到前端的项目，这样的话，我就需要在我的电脑中安装一些配置环境，但是需要配置的文件又比较多，当我在自己的电脑上装完环境后却发现没有办法正常运行项目，所以又换到了公司提供的主机上，相当于刚刚安装完的环境需要再次安装.....<br></p> <p>或者更换了电脑，重装了新系统的情况下，每个开发需要用到的环境都需要重新配置，比如开发需要安装 node、npm、git等工具，长期会导致安装的东西过多又比较乱，所以需要寻找一个可以方便安装，又能进行统一管理的东西。<br></p> <p>Docker2013年发布至今，作为小白的我其实才是刚刚接触到。今天作为一篇学习笔记记录下来</p> <h3 id="☀️docker是什么"><a href="#☀️docker是什么" class="header-anchor">#</a> ☀️Docker是什么</h3> <p><strong>Docker 属于 Linux 容器的一种封装。</strong> 是目前最流行的 Linux 容器解决方案。
它将应用程序与该程序的依赖进行打包。程序在这个虚拟容器里运行，和运行在自己的电脑上没什么区别，也不用配置其他的环境问题，一键式的安装特别方便。</p> <p>Docker的使用比较简单，我们可以将需要用到的程序通过命令安装到容器上，进行统一的版本管理。</p> <p><img src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/2a6287b6d957474e9c9b886436253492~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <h3 id="☀️docker安装"><a href="#☀️docker安装" class="header-anchor">#</a> ☀️Docker安装</h3> <p>我是通过<a href="https://www.docker.com/" target="_blank" rel="noopener noreferrer">官网<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>进行安装Docker的
从右上角的角落进入
<img src="https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/97b4aa88d0e14e5eaa0d98bc3755f5f1~tplv-k3u1fbpfcp-watermark.image?" alt="image.png">
选择自己对应的版本进行安装</p> <p><img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/e16fa4ca53454e5bba2b88b165e7a869~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <p>下载安装的过程比较简单，安装完成后一个小鲸鱼货船就出现了</p> <p><img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/353df356d0014120aad697954c349b3d~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <p>打开的过程中以为没有什么问题，之前同事是在Mac上安装Docker的，可能系统的配置不一样，由于我的是Windows，所以打开的时候会出现一个报错</p> <p><img src="https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/913e0ce7be71415793ca94ae6a92832a~tplv-k3u1fbpfcp-watermark.image?" alt="31bbfa0a9c59778f04d7ce8ff1d1358.png"></p> <p>这个错误出现的概率比较大，网上对应的文章也比较多，docker也很贴心的提供了故障排除的地址，主要就是由于Docker是一个虚拟的linux容器，所以需要系统虚拟化的支持，在这里我也把教程统一放到这里给大家参考。</p> <p>首先确保Hyper-V已安装并正常工作和虚拟机平台，以我的电脑win10专业版为例</p> <p><img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/bc2edbfaf9f74888b4e6801b82ebeeae~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <p><img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/74aa8d255ea946ab98fabe8cf583f046~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <p>然后是对系统开启虚拟化，对于windows如何开启虚拟化教程也是比较多，根据不同的系统win7 win10都可以试试这些文章，都是通过BIOS打开虚拟化支持就行。</p> <p><a href="https://product.pconline.com.cn/itbk/wlbg/office/1906/12700220.html" target="_blank" rel="noopener noreferrer">BIOS启动虚拟化<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p><a href="https://www.php.cn/faq/476405.html" target="_blank" rel="noopener noreferrer">bios如何开启虚拟化支持<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>没有启动虚拟化之前，打开我们的管理器，这个地方是禁用的，如果已经启用，说明虚拟化已经启用</p> <p><img src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/2fcdf7262ed34d6c8884414632ffe23f~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <p>接着打开我们的命令行，先试一下安装一个RabbitMq的环境</p> <div class="language-js extra-class"><pre class="language-js"><code>docker pull rabbitmq
 
docker run <span class="token operator">-</span>d <span class="token operator">--</span>hostname rabbitmq <span class="token operator">--</span>name rabbitmq <span class="token operator">-</span>p <span class="token number">15672</span><span class="token operator">:</span><span class="token number">15672</span> <span class="token operator">-</span>p <span class="token number">5672</span><span class="token operator">:</span><span class="token number">5672</span> rabbitmq
 
docker ps
 
docker exec <span class="token operator">-</span>it rabbitmq <span class="token operator">/</span>bin<span class="token operator">/</span>bash
 
rabbitmq<span class="token operator">-</span>plugins enable rabbitmq_management
 
rabbitmqctl add_user fort fort
 
rabbitmqctl set_user_tags fort administrator
</code></pre></div><p><img src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/31738a19f0f84c94bf663c66892a063d~tplv-k3u1fbpfcp-watermark.image?" alt="image.png">
安装的教程也比较简单，如果需要安装其他工具可以找一下各种安装方式</p> <p><img src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/000d83911c434b43821b9d211952b909~tplv-k3u1fbpfcp-watermark.image?" alt="image.png">
最后也可以成功运行RabbitMQ在我们的docker上，不用多余的操作，只需几行命令行</p> <p><img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/c364c710df95467e9d40f0847be0f8c1~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2023-01-04 10:56:12</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/posts/项目问题解决/axios.html" class="prev">
        项目中对axios的整体封装
      </a></span> <span class="next"><a href="/posts/项目问题解决/eltable.html">
        el-table自定义表头及无数据状态
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----><!----></div></div>
    <script src="/assets/js/app.6514719e.js" defer></script><script src="/assets/js/2.ea114ffb.js" defer></script><script src="/assets/js/43.de1cff16.js" defer></script><script src="/assets/js/4.e093c564.js" defer></script>
  </body>
</html>
